package com.joinlabs.config;

import javax.annotation.Resource;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.joinlabs.interceptor.UserSecurityInterceptor;

@Configuration
public class WebConfig extends WebMvcConfigurerAdapter{

	
	@Resource
	private UserSecurityInterceptor userSecurityInterceptor;
	/**
	 * 添加拦截器
	 */
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		
		registry.addInterceptor(userSecurityInterceptor)
			.addPathPatterns("/user/userinfo")
			.addPathPatterns("/shopcar/*")
			//.addPathPatterns("/product/*")			//拦截的路径
			.addPathPatterns("/user/userimg")
			.excludePathPatterns("/common/*","/login/*")      //白名单(exclude所匹配的路径不拦截)
		;
	}
}

